<?php
/**
 * 商品信息
 * User: yuanxuncheng
 * Date: 2017/1/2
 * Time: 21:45
 */

namespace app\api\controller;

use app\api\model\page\goods\GetGoods as GetGoodsModel;
use app\api\model\page\goods\GetGoodsByCatid as GetGoodsByCatidModel;
use app\api\model\page\goods\SearchGoods as SearchGoodsModel;
use app\api\model\page\goods\GetHotKey as GetHotKeyModel;
use app\api\model\page\goods\GetPromotionRegionGoods as GetPromotionRegionGoodsModel;
use think\Request;

class Goods
{

    private $getGoodsModel;
    private $getGoodsByCatidModel;
    private $searchGoodsModel;
    private $getHotKeyModel;
    private $getPromotionRegionGoodsModel;

    public function __construct()
    {
        $this->param = Request::instance()->param();
    }

    /**
     * @desc 获取商品
     * @return array
     */
    public function getGoods()
    {
        $this->getGoodsModel = new GetGoodsModel();
        return $this->getGoodsModel->excute($this->param);
    }

    /**
     * @desc 根据分类获取商品
     * @return array
     */
    public function getGoodsByCatid()
    {
        $this->getGoodsByCatidModel = new GetGoodsByCatidModel();
        return $this->getGoodsByCatidModel->excute($this->param);
    }

    /**
     * @desc 根据条件搜索商品
     * @return array
     */
    public function searchGoods()
    {
        $this->searchGoodsModel = new SearchGoodsModel();
        return $this->searchGoodsModel->excute($this->param);
    }

    /**
     * @desc 热搜关键字
     * @return array
     */
    public function searchHotKeys()
    {
        $this->getHotKeyModel = new GetHotKeyModel();
        return $this->getHotKeyModel->excute($this->param);
    }

    /**
     * @desc 获取活动专区商品
     * @return array
     */
    public function getPromotionRegionGoods()
    {
        $this->getPromotionRegionGoodsModel = new GetPromotionRegionGoodsModel();
        return $this->getPromotionRegionGoodsModel->excute($this->param);
    }
}
